from sqlalchemy import Column, ForeignKey, Date
from sqlalchemy.orm import relationship
from sqlalchemy.dialects.oracle import VARCHAR2, NUMBER
from app.db.base import Base


# Personal Evaluation Response
class PersonalEvaluationResponse(Base):
    __tablename__ = 'PERSONAL_EVALUATION_RESPONSE'
    __table_args__ = {'schema': 'IARO_CAREER'}

    question_id       = Column(NUMBER, primary_key=True)
    scholar_id        = Column(VARCHAR2(20), ForeignKey('IARO_CAREER.SCHOLARS.scholar_id'))
    per_eva_survey_id = Column(NUMBER)
    ans_response      = Column(VARCHAR2(4000))
    ans_timestamp     = Column(Date)

    # Relationship back to scholar
    scholar = relationship("Scholar", back_populates="personal_responses")